# Attach all the neccesary packages for this project:
library(tidyverse)
library(here)
library(janitor)
library(raster)
library(sf)
library(tmap)
library(tmaptools)
library(gstat)
library(leaflet)
Using provided data make maps of land use / land cover and watersheds for the major islands of Hawaii. Create interactive and static maps which clearly and professionally show the different land use / land cover types for all main Hawaiian islands. Create interactive and static maps which clearly and professionally show the different watersheds for all main Hawaiian islands.
Land Use and Land Cover (LULC) data consists of historical land use and land cover classification data that was based primarily on the manual interpretation of 1970’s and 1980’s aerial photography. Watershead data consists of surface water hyrdrologic unit boundaries (watersheds) for the 8 major Hawaiian Islands.
Land Use Land Cover (LULC) data of main Hawaiian Islands as of 1976. Source: 1:100,000 1976 Digital GIRAS (Geographic Information Retrieval and Analysis) files. Data: http://geoportal.hawaii.gov/datasets/land-use-land-cover-lulc Citation: Hawaii Statewide GIS Program, Office of Planning, State of Hawaii; PO Box 2359, Honolulu, HI 96804; (808) 587-2846; email: gis@hawaii.gov; Website: http://planning.hawaii.gov/gis. Metadata: https://www.arcgis.com/home/item.html?id=e00b356bcc9d4fabb6e07d6319a7b543
Surface Water Hyrdrologic Unit Boundaries (Watersheds) for the 8 major Hawaiian Islands Source: GDSI, 1995, 1999; State of Hawaii Commission on Water Resource Management (CWRM), 2008. Provided to State GIS, August, 2017. Data: http://geoportal.hawaii.gov/datasets/watersheds Citation: Hawaii Statewide GIS Program, Office of Planning, State of Hawaii; PO Box 2359, Honolulu, Hi. 96804; (808) 587-2846; email: gis@hawaii.gov; Website: http://planning.hawaii.gov/gis. Metadata: http://files.hawaii.gov/dbedt/op/gis/data/watersheds_cwrm.pdf
# Read in the shapefiles for both watersheds and land use land cover using 'read_sf'
land_use_land_cover <- read_sf(here("Land_Use_Land_Cover_LULC",
"Land_Use_Land_Cover_LULC.shp"))
watersheds <- read_sf(here("Watersheds",
"Watersheds.shp"))
Land Use Land Cover (LULC) data of main Hawaiian Islands as of 1976 was used to create both an interactive and static map of the different types of land cover and land use across the main Hawaiian Isalnds. Data was gathered from the Hawaii Statewide GIS Program.
# Base plot
# plot(land_use_land_cover) # Code out of the final document.
# Check CRS of the 'land_cover_land_use' shp file:
st_crs(land_use_land_cover)
## Coordinate Reference System:
## EPSG: 4326
## proj4string: "+proj=longlat +datum=WGS84 +no_defs"
# Already set to EPSG 4326 (WGS84 datum):
# Clean the 'land_use_land_cover' dataframe.
land_use_clean <- land_use_land_cover %>%
# Filter out the '0' value for cover type
filter(landcover != "0") %>%
# Seperate the landcover column to only include the first name and the other values in a second column.
separate(landcover, into = c("Landcover", "sub_group"), sep = "\\s",
extra = "merge") %>%
# Remove the word 'and' from any values in the 'sub_group' column.
mutate(sub_group = str_remove(sub_group, "and "))
# Create a vector containing the 'landcover' character values of any 'sub_group' character value of NA.
na_landuse <- land_use_clean$Landcover[is.na(land_use_clean$sub_group)]
# Replace any 'sub_group' value of NA with its' 'Landcover" value using the 'na_landuse' vector.
nona_landuse <- land_use_clean %>%
mutate(sub_group = str_replace_na(sub_group, replacement = na_landuse))
# Create a static map of Hawaii Land cover:
# Set the mode to 'plot' (static)
tmap_mode("plot")
tm_shape(nona_landuse) +
# Set the asthetic to 'Landcover' and change the legend title.
tm_polygons("Landcover",
title = "Land Cover") +
# Add a main title and set all the other asthetics.
tm_layout(main.title = "Hawaii: Land Cover",
main.title.fontface = "bold",
main.title.fontfamily = "serif",
main.title.position = "left",
legend.position = c("left", "bottom"),
legend.title.fontface = "bold",
legend.title.fontfamily = "serif",
legend.text.fontface = "bold.italic",
legend.text.fontfamily = "serif",
legend.outside = TRUE)
Figure 1: A map of land cover types for all of the Hawaiian Islands symbolized by color.
Hover and click on any polygon for more details:
# Create an interactive map of land use and land cover.
# Set the mode to 'view' (interactive)
tmap_mode("view")
# Add a base map
tm_basemap("Esri.OceanBasemap") +
tm_shape(nona_landuse) +
# Set the map asthetics to display landcover
tm_polygons("Landcover",
# Set the pop-up variables
popup.vars=c("Landuse:"="sub_group",
"Area (sq. meters):" = "st_areasha"),
# Set the 'id' to show the land cover type when hovering over a polygon
id = "Landcover",
# Change the legend title
title = "Land Cover")